package APP1.bookShop.book;

import java.util.LinkedList;
import java.util.Set;
import java.util.List;
import APP1.bookShop.people.Author;
import APP1.bookShop.order.OrderBody;
import APP1.bookShop.people.Publisher;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Date;

public class Book {

    public String title;
    public Date publishingDate;
    public String isbn;
    public List<Author> authors;
    public List<OrderBody> orderBody;
    private Publisher publisher;

    public Book() {
        authors = new ArrayList<Author>();

    }

    @Override
    public String toString() {
        return title;
    }

    public String getTitle() {

        return title;
    }

    public Date getPublishingDate() {

        return publishingDate;
    }

    public String getISBN() {
       
        return isbn;
    }

    public List<Author> getAuthors() {

        return authors;
    }

    public void setPublishingDate(Date publishingDate) {
        this.publishingDate = publishingDate;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void addAuthor(Author a) {
        if (!authors.contains(a)) {
            authors.add(a);
            if (!a.getBookList().contains(this)) {
                a.getBookList().add(this);
            }
        }
    }

    public void addPublisher(Publisher pub) {

        if (!pub.getBook().contains(this)) {
            pub.getBook().add(this);
        }

        this.setPublisher(pub);
    }

    public Publisher getPublisher() {
        return publisher;
    }

    public void setPublisher(Publisher publisher) {
        this.publisher = publisher;
        
    }

}
